<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="#{messages['currency.rate.list.title']}">
	<h:panelGrid ><h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText></h:panelGrid>
	
	<h:panelGrid columns="2">
		<h:outputText value="#{messages['select.currency']}" styleClass="standardText_Label"></h:outputText>
		<t:selectOneMenu value="#{currencyRateBean.currencyId}" styleClass="standardText" onchange="document.pform.submit();">
			<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
			<f:selectItems value="#{currencyRateBean.currencySelectList}"/>
		</t:selectOneMenu>
	</h:panelGrid>
	
	<rich:spacer height="15" />
	
	<rich:dataTable id="data" var="currencyRate" value="#{currencyRateBean.currencyRateList}" rows="20" width="99%">
		<rich:column style="text-align:center;width:5%;">
			<f:facet name="header">
				<h:selectBooleanCheckbox id="chkAll" onclick="checkAll(this.form,this)" ></h:selectBooleanCheckbox>
			</f:facet>
			<h:selectBooleanCheckbox id="chk" value="#{currencyRate.markAsAction}"></h:selectBooleanCheckbox>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['local.rate.column']}"></h:outputText>
			</f:facet>
			<t:commandLink action="#{currencyRateBean.navEditAction}" actionListener="#{currencyRateBean.navEditActionEvent}">
				<h:outputText value="#{currencyRate.localRate}">
					<f:convertNumber pattern="##0.00"/>
				</h:outputText>
			</t:commandLink>
			
			<f:param id="currencyRateId" value="#{currencyRate.currencyRateId}" />
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['foreign.rate.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{currencyRate.foreignRate}" >
				<f:convertNumber pattern="##0.0000"/>
			</h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['effective.date.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{currencyRate.effectiveDate}" >
				<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur" />
			</h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['expiry.date.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{currencyRate.expiryDate}" >
				<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
			</h:outputText>
		</rich:column>
	</rich:dataTable>
	
	<rich:spacer height="30" />
	
	<rich:datascroller align="left"  for="data" maxPages="20" />

	<rich:spacer height="30" />
	<t:panelGrid columns="2">
		<h:commandButton value="#{messages['create']}" styleClass="button" action="#{currencyRateBean.navAddAction}" ></h:commandButton>
		<h:commandButton value="#{messages['delete']}" styleClass="button" onclick="#{messages['delete.msg.alert']}" action="#{currencyRateBean.deleteAction}" actionListener="#{currencyRateBean.deleteActionEvent}" ></h:commandButton>
	</t:panelGrid>

            
</rich:panel>
